package com.liang.service.impl;

import com.liang.dao.MovieMapper;
import com.liang.pojo.Movie;
import com.liang.service.MovieService;
import com.liang.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class MovieServiceImpl implements MovieService {
    private SqlSession sqlSession =null;
    private List<Movie> getMovieList=null;


    public List<Movie> getRdMovieList(int userId, int index) {
        sqlSession = MybatisUtils.getSqlSession();
        MovieMapper mapper = sqlSession.getMapper(MovieMapper.class);
        getMovieList = mapper.getRdMovieList(userId, index);
        sqlSession.close();
        return getMovieList;
    }

    public List<Movie> getRdMovieList2(int userId, int index) {
        sqlSession = MybatisUtils.getSqlSessionAuto();
        MovieMapper mapper = sqlSession.getMapper(MovieMapper.class);
        getMovieList = mapper.getRdMovieList2(userId, index);
        sqlSession.close();
        return getMovieList;
    }
}
